package com.mall.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.model.domain.SmsFlashPromotionProductRelation;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author xyiaao
 * @description 针对表【sms_flash_promotion_product_relation(商品限时购与商品关系表)】的数据库操作Mapper
 * @createDate 2022-03-29 19:46:09
 * @Entity com.mall.model.domain.SmsFlashPromotionProductRelation
 */
public interface SmsFlashPromotionProductRelationMapper extends BaseMapper<SmsFlashPromotionProductRelation> {

    @Select("select flash_promotion_session_id, count(product_id) count from sms_flash_promotion_product_relation " +
            "where flash_promotion_session_id in " +
            "(select flash_promotion_session_id  from sms_flash_promotion_product_relation where flash_promotion_id = #{flashPromotionId}) " +
            " group by flash_promotion_session_id")
    List<SmsFlashPromotionProductRelation> count(@Param("flashPromotionId") Long flashPromotionId);

}




